program ProjetoObserverConsole;

{$APPTYPE CONSOLE}

uses
  SysUtils, Classes,
  UIPattern in '..\Interface\UIPattern.pas',
  UEstoque in '..\Class\UEstoque.pas',
  UInvestidor in '..\Class\UInvestidor.pas';

var
  EstoqueX: TEstoque;
  Invest01, Invest02: TInvestidor;

begin
  { TODO -oUser -cConsole Main : Insert code here }
  //ReportMemoryLeaksOnShutdown := DebugHook <> 0;

  //ReportMemoryLeaksOnShutdown := true;
  try
    EstoqueX := TEstoque.Create('Camargo Rodrigues', 150.0);
    Invest01 := TInvestidor.Create('Ademario');
    Invest02 := TInvestidor.Create('Andre');
    try
      EstoqueX.Anexar(Invest01);
      EstoqueX.Anexar(Invest02);

      EstoqueX.Preco := 150.25;
      EstoqueX.Preco := 151.25;
      EstoqueX.Preco := 150.50;
      EstoqueX.Preco := 150.750;

      WriteLn(#10 + 'Remove investidor.');

      EstoqueX.Desanexar(Invest01);

      EstoqueX.Preco := 150.15;
      EstoqueX.Preco := 152.25;
      EstoqueX.Preco := 150.50;
      EstoqueX.Preco := 150.750;

      EstoqueX.Desanexar(Invest02);

      Readln;
    finally
      EstoqueX.Free;
    end;
  except
    on E:Exception do
      Writeln(E.Classname, ': ', E.Message);
  end;
end.
